package com.dyb.demo.collection;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ListDemo {

    public static void method1() {
        // 底层实现是数组，因此不能改变大小
        List<Integer> list = Arrays.asList(1, 2, 3);
        Collections.addAll(list, 4);
        // Exception in thread "main" java.lang.UnsupportedOperationException
        // list.add(5);

    }

    public static  void main(String[] a) {
        ListDemo.method1();
    }
}
